#pragma once

#include "simmodel.h"
#include "Hydraulics.h"
#include <QtGui/QMainWindow>
#include <QtGui/QWidget>
#include <QDialog>
#include "ui_profile.h"
#include <qwt_plot_canvas.h>
#include <qwt_legend.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_curve.h>
#include <qwt_symbol.h>
#include <vector>

using namespace hydraulics;
using namespace std;

class profile : public QDialog
{
	Q_OBJECT
private:
	Ui::profileDialog ui;
	//bool changes;
	QwtLegend *leg;
	QwtPlotGrid *grid;
	QwtPlotCurve *curve;
	
	vector<QTableWidgetItem *> itemCoordinates, itemHeights;
	
	void initGraph();
	void displayTableAndGraph(vector<double>coordinates, vector<double> heights);
	void createGraph(QVector<double>& y, QVector<double>& x);
public:
	profile(QWidget* pwgt = 0);	
	~profile();
	pipeline_profile_t getProfile();
	void setData(const vector<vector<double>>& data);
	
private slots:
	void table_rowCountChanged();
	void on_btnAccept_clicked();
	void on_btnReject_clicked();
	void on_btnLoad_clicked();
	void on_btnAddRow_clicked();
	void on_btnRemoveRow_clicked();
	void on_btnRefresh_clicked();
};
